<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<div id="app">
			<h1>简单计算器</h1>
			<div>
				<span>数值A:</span>
				<span><input type="text" v-model="num1" /></span>
			</div>
			<div>
				<span>数值B:</span>
				<span><input type="text" v-model="num2" /></span>
			</div>
			<div>
				<button @click="handle">计算</button>
			</div>
			<div>
				<span>计算结果：</span>
				<span>{{ result }}</span>
			</div>
		</div>

		<script src="/scripts/vue.js"></script>
		<script>
			var vm = new Vue({
				el: '#app',
				data: {
					num1: '',
					num2: '',
					result: '',
				},
				methods: {
					handle: function () {
						this.result = parseInt(this.num1) + parseInt(this.num2)
					},
				},
			})
		</script>
	</body>
</html>
